{template 'header'}
<link type="text/css" rel="stylesheet" href="../addons/we7_research/template/mobile/common.mobile.css" />
{if $operation == 'display'}
<div class="mobile-div img-rounded">
	<div class="mobile-hd" style="border-bottom:0;">我的活动</div>
	{loop $rows $item}
	<a class="mobile-li" href="{php echo $this->createMobileUrl('myresearch', array('id' => $item['rerid'], 'op' => 'detail'))}">
		<span class="pull-right muted">{php echo date('Y-m-d H:i:s', $item['createtime'])}</span>
		{$research[$item['reid']]['title']}
	</a>
	{/loop}
</div>
{elseif $operation == 'detail'}
<div class="mobile-div img-rounded">
	<div class="mobile-hd">{$research['title']}</div>
	<div class="mobile-content">{$research['content']}</div>
</div>
<div class="mobile-div img-rounded">
	<div class="mobile-hd">我们的回复</div>
	<div class="mobile-content">{$research['information']}</div>
</div>
<div class="mobile-div img-rounded">
	<div class="mobile-hd">我的资料</div>
	<div class="mobile-content">
		<table class="form-table">
			{loop $research['fields'] $item}
			<tr>
				<th><label>{$item['title']}</label></th>
				{if $item['type'] == 'image'}
				<td><a target="_blank" href="{$_W['attachurl']}{$item['data']}" class="btn">点击查看附件</a></td>
				{else}
				<td><span class="uneditable-input">{if !empty($item['data'])}{$item['data']}{else}无{/if}</span></td>
				{/if}
			</tr>
			{/loop}
		</table>
	</div>
</div>
{/if}
<script type="text/javascript">
  wx.ready(function () {
    var shareData = {
    title: "{$settings['share_title']}",
    desc: "{$settings['share_content']}",
    link: "{$settings['share_link']}",
    imgUrl: "{$_W['attachurl']}{$settings['share_logo']}",
  };
  
  //分享朋友
  wx.onMenuShareAppMessage({
       title: shareData.title,
      desc: shareData.desc,
      link: shareData.link,
      imgUrl:shareData.imgUrl,
      trigger: function (res) {
      },
      success: function (res) {
        send_intergal();
      },
      cancel: function (res) {
      },
      fail: function (res) {
        alert(JSON.stringify(res));
      }
    });
 //朋友圈
  wx.onMenuShareTimeline({
      title: shareData.title+"---"+shareData.desc,
      link: shareData.link,
      imgUrl:shareData.imgUrl,
      trigger: function (res) {
      },
      success: function (res) {
          send_intergal();
      },
      cancel: function (res) {
      },
      fail: function (res) {
        Joel_gmuAlert("分享失败","网络超时！！！！");
      }
    });   
    
  });



function send_intergal(){
   $.ajax({
			type:"POST",
			url:"{php echo $this->createMobileUrl('shareajax')}",
			data:{openid:'{$openid}}'},
			cache:false,
			success:function(data){
				if(data=="no"){
					alert("分享成功,抱歉，网络超时，获取积分失败！！！");
                   
				}
				else if(data=="over"){
				   alert("分享成功,你今天的分享次数已经超过上限哦，请明天再来吧！！！");
				
				}
				else{
				   alert("分享成功,恭喜您，获得{$settings['share_jifen']}个奖励积分！今天你还有"+data+"次分享赚积分机会哦！");
				}
			}
		});
}


        </script>
{template 'footer'}